<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>在线Unicode转中文-Betools</title>
    <script type="text/javascript" src="http://jic.betools.vip/common/web/js/jquery.min.js"></script>
    <script type="text/javascript" src="http://jic.betools.vip/tools/js/json.js"></script>
</head>
<body>
    <textarea rows="20" cols="80" id="source">a:3:{s:4:"name";s:6:"huqian";s:3:"sex";s:3:"男";s:3:"age";i:27;}</textarea>
    <br>
    <button id="decode">Unicode转中文</button>
    <button id="encode">中文转Unicode</button>
    <script>
    $("#decode").click(function(){
        var content = $("#source").val();
        var format_content = decodeUnicode(content);
        $("#source").val(format_content);
    });

    $("#encode").click(function(){
        var content = $("#source").val();
        var format_content = encodeUnicode(content);
        console.log(format_content);
        $("#source").val(format_content);
    });
    </script>
</body>
</html>
